package com.hongsheng.util;

/*
@Author：郭振文
@Package：com.hongsheng.util
@File：AuthoritySqlProvider
@Date：2023/8/18 9:29
*/

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.jdbc.SQL;

public class AuthoritySqlProvider {
    public static String getAuthorityByCondition(@Param("authorityName") String authorityName,
                                            @Param("features") String features) {
        return new SQL() {{
            SELECT("*");
            FROM("tb_authority");
            if (authorityName != null && !authorityName.isEmpty()) {
                WHERE("authority_name like #{authorityName}");
            }
            if (features != null && !features.isEmpty()) {
                WHERE("features like #{features}");
            }
        }}.toString();
    }
}
